package com.qihoo.finance.fake.module.msf.dao;

import com.qihoo.finance.fake.module.msf.entity.generate.SystemDictEntity;
import com.qihoo.finance.fake.module.msf.entity.generate.SystemParamEntity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface SystemGeneralDao {

    @Select("<script> " +
            "select id, type, value, label, description, sort, status, module, date_effective, date_expire," +
            "    date_created, created_by, date_updated, updated_by, version from system_dict" +
            " where (module = 'COMMON' or module in <foreach item='item' index='index' collection='modules' open='(' separator=',' close=')'> #{item}</foreach>)" +
            " and date_effective &lt;= now() and date_expire &gt; now()" +
            "</script>")
    List<SystemDictEntity> queryValidOfModules(@Param("modules") List<String> modules);

    @Select("<script> " +
            "select id, code, name, value1, value2, value3, value4, remark, status, module, date_effective," +
            "    date_expire, date_created, created_by, date_updated, updated_by, version from system_param where (module = 'COMMON' or module in <foreach item='item' index='index' collection='modules' open='(' separator=',' close=')'> #{item}</foreach>)" +
            " and date_effective &lt;= now() and date_expire &gt; now()" +
            "</script>")
    List<SystemParamEntity> querySystemParamValidOfModules(@Param("modules") List<String> modules);
}
